<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="s"%>
<%@page import="forecast.domain.Activity"%>
<!DOCTYPE html>
<%@include file="../top.jsp" %>


   	<div class="container-fluid">
	     <div class="row-fluid">
        <div class="span2">
          <div class="well sidebar-nav">
          	<ul class="nav nav-list">
          	  <li class="nav-header"><a href="<c:url value="/" />">Welcome</a></li>	
			  <li class="nav-header">Forecast</li>
			  <li><a href="<c:url value="/activity" />">Activities</a></li>			 			
			  <li><a href="<c:url value="/reports" />">Reports</a></li>	
			  </ul>  
          </div><!--/.well -->
        </div><!--/span-->
        <div class="span10">         
            <div class="hero-unit">
              <h1>Your activities</h1>     
            </div>
            <div class="row-fluid">
              <div class="span12">
                  <div class="container" align="center">
  					 <table class="table table-bordered table-striped table-hover">
				    <thead>
				      <tr>
				        <th>#</th>
				        <th>Name</th>
				        <th>1</th>
				        <th>2</th>
				        <th>3</th>
				        <th>4</th>
				      </tr>
				    </thead>
				    <tbody>	
				    	 
					 	<c:forEach var="activity" items="${activities}" varStatus="rowCounter" >
					 	<form:form id="form" method="post" modelAttribute="forecast"
							class="form-horizontal well">
						<tr>
					        <td>${activity.id}</td>
					        <td>${activity.assigmentName}</td>
					        <td><div
									class="control-group ${requestScope['org.springframework.validation.BindingResult.activity'].hasFieldErrors('eka') ? 'error' : ''}">
									<div class="controls">
										<form:input path="eka" value="${activity.eka}"/>
										</div>
								</div></td>
					        <td><div
									class="control-group ${requestScope['org.springframework.validation.BindingResult.activity'].hasFieldErrors('toka') ? 'error' : ''}">
									<div class="controls">
										<form:input path="toka" value="${activity.toka}"/>
									</div>
								</div></td>
					        <td><div
									class="control-group ${requestScope['org.springframework.validation.BindingResult.activity'].hasFieldErrors('kolmas') ? 'error' : ''}">
									<div class="controls">
										<form:input path="kolmas" value="${activity.kolmas}"/>
									</div>
								</div></td>
					        <td><div
									class="control-group ${requestScope['org.springframework.validation.BindingResult.activity'].hasFieldErrors('neljas') ? 'error' : ''}">
									<div class="controls">
										<form:input path="neljas"value="${activity.neljas}" />
									</div>
								</div></td>
							<form:input path="activityId" type="hidden" value="${activity.id}" />
							<td><button type="submit" class="btn btn-primary">Update</button></td>
				     	 </tr>

					   
					   </form:form>
					   </c:forEach>
					   <tr>
					   <td></td>
					   <td></td>
					   <td>${requestScope.totalEka}</td>
					   <td>${requestScope.totalToka}</td>
					   <td>${requestScope.totalKolmas}</td>
					   <td>${requestScope.totalNeljas}</td>
					   </tr>	     
				    </tbody>
				  </table>
  					<p><a href="<c:url value="/activity/create" />">Create a new activity</a></p>
                  </div>
<%@include file="../bottom.jsp" %>